﻿namespace GFramework.Netwrok
{
    public sealed class NetConnectedEventArgscs : GEventArgs
    {
        public static NetConnectedEventArgscs Create(INetChannel networkChannel, object userData)
        {
            NetConnectedEventArgscs netConnectedEventArgs = ReferencePool.Acquire<NetConnectedEventArgscs>();
            netConnectedEventArgs.NetChannel = networkChannel;
            netConnectedEventArgs.UserData = userData;
            return netConnectedEventArgs;
        }

        /// <summary>
        /// 获取网络频道。
        /// </summary>
        public INetChannel NetChannel
        {
            get;
            private set;
        }

        /// <summary>
        /// 获取用户自定义数据。
        /// </summary>
        public object UserData
        {
            get;
            private set;
        }

        public NetConnectedEventArgscs()
        {
            NetChannel = null;
            UserData = null;
        }

        public override void Clear()
        {
            NetChannel = null;
            UserData = null;
        }
    }
}
